package paa.simulator.model;

import java.util.Collection;
import java.util.Iterator;

import paa.simulator.grafo.PessoaVertex;
import paa.simulator.grafo.simple.PessoaEdge;
import paa.simulator.grafo.simple.UndirectedSimpleGraph;

public abstract class AbstractModel implements Model {

	public void setAsBuying(PessoaVertex pv, UndirectedSimpleGraph<PessoaVertex> graph) {
		pv.setAsBuying();
		
		Collection<PessoaEdge<PessoaVertex>> edges = graph.edgesOf(pv);
		Iterator<PessoaEdge<PessoaVertex>> it = edges.iterator();
		while (it.hasNext()) {
			PessoaEdge<PessoaVertex> next = it.next();
			PessoaVertex other = next.getRelation(pv);
			other.incInfluence();
		}
	}	
}